package logon.action;

import com.opensymphony.xwork2.ActionSupport;
import logon.dao.LogonDao;
import com.opensymphony.xwork2.ActionContext;
import java.util.Map;





public class logonAction extends ActionSupport{


	private String id;
	private String password;
	
	
	
	public String form() throws Exception {
		
		return SUCCESS;
	}


	public String execute() throws Exception {

		
		int check = LogonDao.checkId(id,password); 

		if(check==1){
			 ActionContext context = ActionContext.getContext();
			  Map<String, String> session = (Map<String, String>)context.getSession();
			  session.put("id", id);
			  session.put("password", password);
			  context.setSession(session);

			
				return "success";
			
	
		}else{
			
				return "err";
		
	}
}



	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}


